<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">运输业务管理-报销信息列表</li>
    </ol>
    
    <div class="ms-content-layout">
      
	    <div class="ms-operation-bar no-margin no-bottom-border clearfix">
	      <div class="ms-operation-group pull-right">
          <a href="javascript:void(0);" data-url="${ctx.host}/expense-sheets/setup-oils" data-target="#reimburse-setup" data-toggle="modal" class="btn ms-btn ms-btn-blue set-oil-usage">
            <i class="glyphicon glyphicon-cog"></i>&nbsp;&nbsp;设置油量
          </a>
        
          <a href="${ctx.host}/expense-sheets/export-oil-price" data-target="#oil-price-print" data-toggle="modal" class="btn ms-btn ms-btn-blue export-oil-price">
            <i class="glyphicon glyphicon-check"></i>&nbsp;&nbsp;打印油费
          </a>
          
          <a href="${ctx.host}/expense-sheets/export" data-target="#reimburse-print" data-toggle="modal" class="btn ms-btn ms-btn-blue export-reimburse">
            <i class="glyphicon glyphicon-check"></i>&nbsp;&nbsp;新版打印
          </a>
        </div>
      </div>
      
      <div class="invalid-message hide">
        <h6>提醒&nbsp;:&nbsp;请至少选择一条派车单</h6>
      </div>
      
      <table class="table table-hover ms-table">
        <thead>
            <tr>
              <th><input type="checkbox" name="select-all" /></th>
              <th>运输公司</th>
              <th>派车单号</th>
              <th>起始地</th>
              <th>目的地</th>
              <th>计划出发日期</th>
              <th>商品车数量</th>
              <th>重载公里数</th>
              <th>空载公里数</th>
              <th>路桥费</th>
              <th>其他费用</th>
              <th>总油耗</th>
              <th>内部加油量</th>
              <th>内部油补差量</th>
              <th>内部油价</th>
              <th>外部油价</th>
              <th>重载油耗</th>
              <th>空载油耗</th>
            </tr>
        </thead>
        <tbody>
          <c:forEach items="${result}" var="result">
            <tr>
              <td>
                <c:choose>
                  <c:when test="${result.expensePrint}">
                    <input type="checkbox" name="dispatchOrderId" checked value="${result.id}" data-expenseprint="${result.expensePrint}" data-reimbursed="${result.expenseReimbursed}" />
                  </c:when>
                  <c:when test="${not empty selectDispatchOrderIds}">
                    <input type="checkbox" name="dispatchOrderId" ${selectDispatchOrderIds.containsKey(result.idString) ? 'checked' : ''} value="${result.id}" data-expenseprint="${result.expensePrint}" data-reimbursed="${result.expenseReimbursed}" />
                  </c:when>
                  <c:otherwise>
                    <input type="checkbox" name="dispatchOrderId" value="${result.id}" data-expenseprint="${result.expensePrint}" data-reimbursed="${result.expenseReimbursed}" />
                  </c:otherwise>
                </c:choose>
              </td>
              <td>${result.organizationName}</td>
              <td>${result.dispatchOrderCode}</td>
              <td>${result.startFacilityName}</td>
              <td>${result.endFacilityName}</td>
              <td><fmt:formatDate value="${result.leavingTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
              <td>${result.actualLoadNumber}</td>
              <td><fmt:formatNumber value="${result.fullLoadDistance}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.emptyLoadDistance}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.roadFee}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.otherFee}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.oilUsage}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.internalOilUsage}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.internalOilUsageCompen}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.internalOilPrice}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.externalOilPrice}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.fullOilUsagePerKm}" minFractionDigits="2" /></td>
              <td><fmt:formatNumber value="${result.emptyOilUsagePerKm}" minFractionDigits="2" /></td>
            </tr>
          </c:forEach>
        </tbody>
        
      </table>

    </div> 
  </div>       
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/business/expense-sheet/expense-sheet-list.js" />
  <script type="text/javascript">
    require(['page/business/expense-sheet/expense-sheet-list'], function(page) {
      page.init();
    })
  </script>
  
</body>
</html>